import 'package:enterprise_v6_app/app/core/values/gaps.dart';
import 'package:enterprise_v6_app/app/modules/task/task_all/responsibility/security_responsibility_controller.dart';
import 'package:enterprise_v6_app/app/modules/task/task_all/responsibility/task_list/task_list_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

/// 包保责任页面
class SecurityResponsibilityPage extends StatelessWidget {
  SecurityResponsibilityPage({super.key});

  final controller = Get.put(SecurityResponsibilityController());

  @override
  Widget build(BuildContext context) {
    if (controller.workTypeDicIdMap.isEmpty) {
      return Container();
    }
    return DefaultTabController(
      length: 3,
      child: GetBuilder(
          init: controller,
          builder: (_) {
            return Scaffold(
                body: Container(
              color: const Color(0xffF5F5F6),
              child: Column(
                children: [
                  AppGaps.vGap12,
                  Container(
                    height: 54.w,
                    decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.circular(8.r),
                    ),
                    margin: EdgeInsets.symmetric(horizontal: 14.w),
                    child: TabBar(
                      controller: controller.tabController,
                      tabs: const [
                        Tab(text: '主要负责人'),
                        Tab(text: '技术负责人'),
                        Tab(text: '操作负责人'),
                      ],
                      dividerColor: Colors.transparent,
                      labelPadding: EdgeInsets.only(bottom: 20.w),
                      labelStyle: TextStyle(
                        fontSize: 16.sp,
                        fontWeight: FontWeight.w500,
                      ),
                      unselectedLabelStyle: TextStyle(
                        fontSize: 16.sp,
                        fontWeight: FontWeight.w500,
                      ),
                      labelColor: Colors.black,
                      unselectedLabelColor: const Color(0xffA0A7B5),
                      indicatorPadding: EdgeInsets.only(top: 35.w, bottom: 10.w),
                      indicator: const BoxDecoration(
                        image: DecorationImage(
                          image: AssetImage(
                            'assets/images/icon_select_arc.png',
                          ),
                        ),
                      ),
                    ),
                  ),
                  AppGaps.vGap10,
                  Expanded(
                    child: Container(
                      color: const Color(0xffF5F5F6),
                      child: TabBarView(
                        controller: controller.tabController,
                        children: [
                          TaskListPage(type: 1, globalKey: controller.globalKey1),
                          TaskListPage(type: 2, globalKey: controller.globalKey2),
                          TaskListPage(type: 3, globalKey: controller.globalKey3),
                        ],
                      ),
                    ),
                  ),
                ],
              ),
            ));
          }),
    );
  }
}
